const express = require('express')
const uA = require('../util/userAgent')
const colors = require('colors-console')
require('./routerTabel')
const router = express.Router()


const {requestHome} = require('../Home/index')
const {detail} = require('../detail/index')
const {playRouter} = require('../play/index')
const {CateHandler} = require('../cate/index')
const {searchHandler} = require('../search/index')
const {getCateDetail} = require('../cate/detail/detail')
const {catchApi,postcatchApi} = require('../catchApi/catch')

router.get('/home',(req,res)=>requestHome(req,res)) // 获取首页
router.get('/detail',(req,res) => detail(req,res)) // 获取详情页面地址 path地址为 每个item返回的'item_path' ?path=vodhtml/guzhuyizhi/
router.get('/play',(req,res)=>playRouter(req,res)) // 获取播放地址
router.get('/cate',(req, res)=>CateHandler(req,res)) // 获取首页分类数据
router.get('/cate/detail',(req,res) => getCateDetail(req,res)) // 获取分类下面的详情 /vodtypehtml/lianxuju/
router.post('/search',(req,res) => searchHandler(req,res)) // 搜索





// 测试路由
router.get('/catchapi',(req,res) => catchApi(req,res))
router.post('/postcacheapi',(req,res)=>postcatchApi(req,res)) // 无法协商缓存


module.exports = router
